package com.wenx.ftpcamel;

import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.PollingConsumer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.model.ModelCamelContext;

import java.io.File;
import java.io.FileInputStream;
import java.time.LocalDateTime;


/**
 * Created by wenx on 2019-07-22 10:07
 */
public class FileTest6 {

    public static void main(String[] args) throws Exception {
        ModelCamelContext camelContext = new DefaultCamelContext();

        camelContext.start();

        camelContext.addRoutes(new RouteBuilder() {

            @Override
            public void configure() {
                from("quartz://myscheduler?cron=0+*+*+*+*+?+*")
                        .pollEnrich("file:E:\\test?fileName=aa.txt")
                        .process(exchange -> {
                            System.out.println(LocalDateTime.now());
                        })
                        .to("file:D:\\test");
            }
        });

        synchronized (FileDemo1.class) {
            FileDemo1.class.wait();
        }
    }

}
